package com.yaolisheng.poetryandode.controller;

import com.yaolisheng.poetryandode.common.utils.MDUtil;
import com.yaolisheng.poetryandode.entity.TBlog;
import com.yaolisheng.poetryandode.service.TBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author yls
 * @Date 2021/6/9 9:44
 * @Version 1.0
 */

@Controller
@RequestMapping("/blog")

public class BolgDetailscontroller {

    @Value("${uploadFile.path}")
    private String path;

    @Autowired
    private TBlogService blogService;

    @RequestMapping("/details")
    public String toDetails(String id, Model model) {
        System.out.println(id);

        TBlog tBlog = blogService.queryById(Long.parseLong(id));
//        String con = MDUtil.pegDown(tBlog.getContent());
//        tBlog.setContent(con);
        model.addAttribute("blog",tBlog);

        return "blog";
    }

}
